﻿using System;
using System.Data;

namespace EaseDapper.Interface
{
    public interface IExecute
    {
        /// <summary>
        /// 执行sql，返回影响行数
        /// </summary>
        /// <param name="sql">sql信息，如select * from test1 where id=@id</param>
        /// <param name="Parameters">参数，如new { id = 10 }</param>
        /// <returns></returns>
        int Execute(string sql, object Parameters = null);

        /// <summary>
        /// 无事务操作，用于查询
        /// </summary>
        /// <param name="action">委托操作</param>
        void ExecuteWithoutTransaction(Action<IDbConnection> action);

        /// <summary>
        /// 事务操作，用于增、删、改
        /// </summary>
        /// <param name="func"></param>
        /// <returns></returns>
        int ExecuteWithTransaction(Func<IDbConnection, IDbTransaction, int> func);
    }
}
